<%--
  Created by IntelliJ IDEA.
  User: qiliping
  Date: 16/4/9
  Time: 下午7:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="paging" uri="paging-taglib" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
    <title>基金结算详情</title>
    <script>
        $(function(){
            if($("#withdrawType").val() == 1){
                $("#withdraw_amount_div").show();
            }

            $("#withdrawType").change(function(){
               var ty = $(this).val();
                if(ty==1){
                    $("#withdraw_amount_div").show();
                }else{
                    $("#withdraw_amount_div").hide();
                }
            });
        })
    </script>
</head>
<body>
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">
            投资管理
            <small>基金认购列表</small>
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="fa fa-home"></i>
                <a href="${ctx}/main">
                    首页
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="${ctx}/invest/settlement_list">
                    基金结算管理
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="#">
                    基金结算列表
                </a>
            </li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>

<div class="main">

    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-primary">

                <div class="panel-body">
                    <div class="form-group">
                        <label class="control-label">基金名称：</label>
                        <span>${settlement.productName}</span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">客户姓名：</label>
                        <span>${settlement.userName}</span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">客户手机号：</label>
                        <span>${settlement.userPhone}</span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">结算类型：</label>
                        <span>
                         <c:choose>
                             <c:when test="${settlement.settlementType==2}">
                                 合同到期结算
                             </c:when>
                         </c:choose>
                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">结算时间 ：</label>
                        <span>
                         <fmt:formatDate value="${settlement.settlementTime}" pattern="yyyy-MM-dd"/>
                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">结算前净值：</label>
                        <span>
                        ${settlement.settlementOldNetvalue }元
                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">结算后净值：</label>
                        <span>
                            ￥${settlement.settlementNewNetvalue}元

                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label pull-left">结算前份额：</label>
                        <span>
                            <fmt:formatNumber value="${settlement.settlementOldQuantity}"
                                              type="number" maxFractionDigits="4" minFractionDigits="4"></fmt:formatNumber>份
                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label pull-left">结算后份额：</label>
                        <span>
                            <fmt:formatNumber value="${settlement.settlementNewQuantity}"
                                              type="number" maxFractionDigits="4" minFractionDigits="4"></fmt:formatNumber>份
                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">投资金额：</label>
                        <span>
                            ￥${settlement.investmentAmount}元

                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">盈利：</label>
                        <span>
                            ￥<fmt:formatNumber value="${settlement.investmentIncome}" type="number" maxFractionDigits="4" minFractionDigits="4"></fmt:formatNumber>元
                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">投资者实际收益：</label>
                        <span>
                            ￥<fmt:formatNumber value="${settlement.investmentIncome /100 * settlement.incomeInvestorDivided}" type="number" maxFractionDigits="4" minFractionDigits="4"></fmt:formatNumber>元

                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label pull-left">提现类型：</label>
                        <span>
                            <c:choose>
                                <c:when test="${settlement.withdrawType==-1}">
                                    未确认
                                </c:when>
                                <c:when test="${settlement.withdrawType==0}">
                                    不提现,继续投资
                                </c:when>
                                <c:when test="${settlement.withdrawType==1}">
                                    收益部分提现
                                </c:when>
                                <c:when test="${settlement.withdrawType==2}">
                                    收益全部提现
                                </c:when>
                            </c:choose>
                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label pull-left">提现金额：</label>
                        <span>

                                    <fmt:formatNumber value="${settlement.withdrawAmount}"
                                                      type="number" maxFractionDigits="4" minFractionDigits="4"></fmt:formatNumber>元
                        </span>
                    </div>

                    <div class="form-group">
                        <label class="control-label pull-left">状态：</label>
                        <span>
                           <c:choose>
                               <c:when test="${settlement.settlementStatus == 0}">
                                   结算未确认
                               </c:when>

                               <c:when test="${settlement.settlementStatus == 1}">
                                   客户已确认
                               </c:when>
                               <c:when test="${settlement.settlementStatus == 2}">
                                   已完成
                               </c:when>

                           </c:choose>

                        </span>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <c:choose>
        <c:when test="${result==1}">
            <div class="row">
                <div class="col-md-12">
                    <div class="form-group">
                        <label class="control-label col-md-3"></label>

                        <div class="col-md-3">
                            <div class="input-group">结算操作成功!</div>
                        </div>

                    </div>
                </div>
            </div>
        </c:when>
        <c:when test="${result==-1}">
            <div class="row">
                <div class="col-md-12">
                    <div class="form-group">
                        <label class="control-label col-md-3"></label>

                        <div class="col-md-3">
                            <div class="input-group">数据不存在!</div>
                        </div>

                    </div>
                </div>
            </div>
        </c:when>
        <c:when test="${result==-2}">
            <div class="row">
                <div class="col-md-12">
                    <div class="form-group">
                        <label class="control-label col-md-3"></label>

                        <div class="col-md-3">
                            <div class="input-group">结算已经确认过了!</div>
                        </div>

                    </div>
                </div>
            </div>
        </c:when>
        <c:otherwise>
            <c:if test="${settlement.settlementStatus!=2}">
                <div class="row">
                    <div class="col-md-12">
                        <form:form method="post" modelAttribute="SettlementConfrimModel" class="form-horizontal">
                            <form:hidden path="settlementId"></form:hidden>
                            <div class="form-group">
                                <label class="control-label col-md-3">提现方式：</label>

                                <div class="col-md-3">
                                    <div class="input-group">
                                        <form:select path="withdrawType" cssClass="form-control">


                                            <form:option value="0">不提取收益,收益续投</form:option>
                                            <form:option value="2">收益全部提取</form:option>
                                            <form:option value="1">收益部分提取</form:option>
                                        <<%--%--<select name="withdrawType" class="form-control" id="withdrawType">&ndash;%&gt;
                                            <option value="1">部分提前分红</option>
                                            <option value="0">不提现,继续投资</option>
                                            &lt;%&ndash;<c:if test="${settlement.investmentIncome /100 * settlement.incomeInvestorDivided > 0}">&ndash;%&gt;
                                                <option value="2">全部提前分红</option>--%>
                                                <%--<option value="1">部分提前分红</option>--%>
                                            <%--</c:if>--%>

                                        <%--</select>--%>
                                        </form:select>
                                    </div>
                                </div>
                                <form:errors path="withdrawAmount" cssClass="field-validation-error"
                                             element="div"></form:errors>
                            </div>

                            <div class="form-group" id="withdraw_amount_div" style="display: none">
                                <label class="control-label col-md-3">提现金额：</label>

                                <div class="col-md-3">
                                    <div class="input-group">
                                        <form:input path="withdrawAmount" cssClass="form-control" placeholder=""></form:input>

                                    </div>
                                </div>
                                <form:errors path="withdrawAmount" cssClass="field-validation-error"
                                             element="div"></form:errors>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-md-3">确认日期：</label>

                                <div class="col-md-4">
                                    <div class="input-daterange input-group">
                                        <form:input path="withdrawDate" cssClass="form-control fromdatetime col-md-4"
                                                    maxlength="10"
                                                    placeholder=""></form:input>
                                    </div>
                                </div>
                                <form:errors path="withdrawDate" cssClass="field-validation-error" element="div"></form:errors>
                            </div>
                            <div class="form-group">
                                <div class="col-md-9 col-md-offset-3">
                                    <button type="submit" class="btn blue">确认结算</button>

                                    <span class="field-validation-error">${error}</span>
                                </div>
                            </div>
                        </form:form>

                    </div>
                </div>
            </c:if>
        </c:otherwise>

    </c:choose>


</div>
</body>
</html>
